cmake_minimum_required(VERSION 2.8)
project(udock)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -std=c++0x")

# set default build type to debug
if(NOT CMAKE_BUILD_TYPE)
    message(":::::::::::::::::: No build type set; defaulting to debug")
    set(CMAKE_BUILD_TYPE "Debug")
endif(NOT CMAKE_BUILD_TYPE)
message(":::::::::::::::::: Build Type: ${CMAKE_BUILD_TYPE}")

# detect os and set OS variable to the resulting value
if(WIN32)
    set(OS "win32")
endif(WIN32)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
    set(OS "linux")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")


if(ENABLE_TESTING)
    enable_testing()
endif(ENABLE_TESTING)

include_directories("src")

subdirs(src)


# setup doxygen documentation system
find_package(Doxygen)
if(DOXYGEN_FOUND)
	set(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen")
	mark_as_advanced(DOXYGEN_LANGUAGE)
	set(DOXYGEN_SOURCE_DIR ${CMAKE_SOURCE_DIR})
	set(CMAKE_DOXYGEN_IMAGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/img")
	set(DOXYGEN_OUTPUT_DIR html)
	configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
	add_custom_target(doc
		${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
		COMMENT "Generating API documentation with Doxygen" VERBATIM )
endif(DOXYGEN_FOUND)
